package com.itheima.d2_Timer;

import java.util.Timer;
import java.util.TimerTask;

/**
 * 定时器Api:
 *          1.schedule--->单线程定时器
 *          2.ScheduleExecutorService
 */
public class demo1 {
    public static void main(String[] args) {
        Timer t1 = new Timer();
        t1.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName()+"执行一次");
            }
        },3000,2000);
    }
}
